package Set;

import com.sun.org.apache.xml.internal.serializer.TransformStateSetter;

import java.util.TreeSet;

public class TreeSetTest {
    public static void main(String[] args) {
        TreeSet<Integer> treeSet =new TreeSet<>();//自动排序,调用一组对象的compareTo方法,返回值为0位重复元素
        treeSet.add(3);
        treeSet.add(2);
        treeSet.add(1);
        treeSet.add(10);
        System.out.println(treeSet.add(3));//false
        for (Integer tree: treeSet) {
            System.out.print(tree+"\t");
        }
        System.out.println();
    }
}
